#!/bin/bash

NDK=/home/xlb/tool/android-ndk-r12b  
PREFIX=$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-
PLATFORM=$NDK/platforms/android-24/arch-arm 

SRC_DIR=../ffmpeg-2.8
INSTALL_DIR=../android/out32

cd $SRC_DIR
make clean
rm -rf $INSTALL_DIR

./configure_android --target-os=linux --prefix=$INSTALL_DIR \
--enable-cross-compile \
--enable-runtime-cpudetect \
--disable-asm \
--arch=arm \
--disable-stripping \
--cross-prefix=$PREFIX \
--sysroot=$PLATFORM \
--extra-cflags="-fPIC -DANDROID -Wfatal-errors -Wno-deprecated "  \
--enable-gpl --enable-nonfree --enable-version3 --enable-small \
--enable-shared --disable-static \
--disable-doc --disable-programs --disable-debug --disable-ffmpeg --disable-ffprobe --disable-ffplay --disable-ffserver \
--disable-postproc --disable-avdevice  --disable-avfilter  --disable-swresample \
--disable-everything \
--enable-decoder=h264 --enable-decoder=hevc --enable-decoder=aac --enable-decoder=mjpeg \
--enable-muxer=mp4 --enable-muxer=mov --enable-muxer=flv --enable-muxer=hls  \
--enable-muxer=mjpeg --enable-muxer=image2 \
--enable-muxer=rtsp --enable-muxer=rtp --enable-muxer=mpegts --enable-muxer=h264 \
--enable-demuxer=mov --enable-demuxer=h264  --enable-demuxer=mpegts  --enable-demuxer=flv --enable-demuxer=hls\
--enable-demuxer=image2 --enable-demuxer=image_jpeg_pipe --enable-demuxer=mjpeg \
--enable-demuxer=rtsp  --enable-demuxer=rtp  --enable-demuxer=sdp \
--enable-parser=aac --enable-parser=h264 \
--enable-bsf=aac_adtstoasc --enable-bsf=h264_mp4toannexb \
--enable-protocol=file --enable-protocol=hls --enable-protocol=http --enable-protocol=https \
--enable-protocol=rtp --enable-protocol=tcp --enable-protocol=udp --enable-protocol=rtmp \
--enable-encoder=png --enable-decoder=png --enable-parser=png --enable-demuxer=image_png_pipe --enable-muxer=dash \
--enable-encoder=gif --enable-decoder=gif --enable-muxer=gif --enable-demuxer=gif 
  
make  

make install  
  
cd $INSTALL_DIR/lib

rm -rf !(*-*.so) 

